﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>表单验证</title>
<link type="text/css" rel="stylesheet" href="../Bubble/bubble.css"/>
<script type="text/javascript" src="prototype-1.6.0.3.js"></script>
<script type="text/javascript" src="Validaion.js"></script>
<script type="text/javascript" src="../Bubble/bubble.js"></script>
<script type="text/javascript">
//window.onresize = function(){alert(0)}
var demo;
function init(){
	//demo = new BubbleValidator("demo");
	demo = new EmapValidator("demo");
	//demo = new Validator("demo");
	demo.add(new VRequired("required",{min:5}));
	demo.add(new VEMail("EMail")); 
	demo.add(new VNumerical("Numerical"));
	/*var o = new Numerical("Numerical","数值","请输入正确的数值!!");
		o.matching = function (value){
			return /^\d+$/.test(value);
		}
	demo.add(o);*/
	demo.add(new VAlpha("Alpha"));
	demo.add(new VDate("Date"));
	demo.add(new VChinese("Chinese"));
	demo.add(new VURL("URL"));
	demo.add(new VAlphaNumeric("AlphaNumeric")).add(new VPhone("Phone"));
	demo.add(new VRequired("requiredpass"));
	demo.add(new VCompare("Compare","requiredpass"));
	demo.prepare = function(){
		$('required').value = '123456';
	}
}
</script>
<style type="text/css">
.error{ font-size:10px; color:red; margin-left:15px;}
</style>
</head>
<body onLoad="init();">
<div style="width: 400;">
  <form method="post" id="demo" action="">
    <fieldset>
      <table width="400" align="center">
        <tbody>
          <tr>
            <td> 非空验证 </td>
            <td>&nbsp;</td>
            <td>&nbsp;
              <input type="text" id="required" name="required" /></td>
          </tr>
          <tr>
            <td> EMail: </td>
            <td>&nbsp;</td>
            <td>&nbsp;
              <input type="text" id="EMail" name="EMail" /></td>
          </tr>
          <tr>
            <td> 数值验证: </td>
            <td>&nbsp;</td>
            <td>&nbsp;
              <input type="text" id="Numerical"	name="Numerical" /></td>
          </tr>
          <tr>
            <td> 英文字母验证: </td>
            <td>&nbsp;</td>
            <td>&nbsp;
              <input type="text" id="Alpha" name="Alpha"></td>
          </tr>
          <tr>
            <td> 日期验证; </td>
            <td>&nbsp;</td>
            <td>&nbsp;
              <input type="text" id="Date" name="Date" /></td>
          </tr>
          <tr>
            <td> 汉字验证: </td>
            <td>&nbsp;</td>
            <td>&nbsp;
              <input type="text" id="Chinese"
										name="Chinese" /></td>
          </tr>
          <tr>
            <td> 网址验证; </td>
            <td>&nbsp;</td>
            <td>&nbsp;
              <input type="text" id="URL" name="URL" /></td>
          </tr>
          <tr>
            <td> 英文/数字; </td>
            <td>&nbsp;</td>
            <td>&nbsp;
              <input type="text" id="AlphaNumeric"
										name="AlphaNumeric" /></td>
          </tr>
          <tr>
            <td> 电话号码: </td>
            <td>&nbsp;</td>
            <td>&nbsp;
              <input type="text" id="Phone" name="Phone" /></td>
          </tr>
          <tr>
            <td> 密码: </td>
            <td>&nbsp;</td>
            <td>&nbsp;
              <input type="password" id="requiredpass"
										name="requiredpass" /></td>
          </tr>
          <tr>
            <td> 比较验证: </td>
            <td>&nbsp;</td>
            <td>&nbsp;
              <input type="password" id="Compare"
										name="Compare" /></td>
          </tr>
          <tr>
            <td colspan="3" align="center"><input type="submit" value="提交" /><input maxlength=""/>
              <input type="reset" value="重置"/></td>
          </tr>
        </tbody>
      </table>
    </fieldset>
  </form>
</div>
</body>
</html>
